import request from '@/utils/request'
import querystring from 'querystring'

/**
 * 分页查询广告
 * @param {*} form 
 * @param {*} pageSize 
 * @param {*} currentPage 
 */
export function dataList(form, pageSize, currentPage) {
  const data = {
    param: form,
    pageSize: pageSize,
    pageNo: currentPage
  }
  return request.post('/advertising/page',data)
}
/**
 * 新增广告
 * @param {*} options 
 */
export function addData(options) {
  return request.post('/advertising/save', options)
}

/**
 * 修改广告
 * @param {*} options 
 */
export function updateData(options) {
  return request.put('/advertising/save', options)
}

/**
 * 获取广告详情
 * @param {*} id 
 */
export function details(id) {
  return request.get(`/advertising/findById/${id}`)
}

/**
 * 删除广告
 * @param {*} id 
 */
export function deleteData(id) {
  return request.delete(`/advertising/del/${id}`)
}

/**
 * 启用或停用广告
 * @param {*} id 
 */
export function status(id, type) {
  return request.get(`/advertising/${type}/${id}`)
}
